//https://github.com/cypress-io/cypress/issues/461#issuecomment-325402086
const command = () => {
  let LOCAL_STORAGE_MEMORY = {}
  Cypress.Commands.add("saveLocalStorage", () => {
    Object.keys(localStorage).forEach((key) => {
      LOCAL_STORAGE_MEMORY[key] = localStorage[key]
    })
  })
  Cypress.Commands.add("restoreLocalStorage", () => {
    Object.keys(LOCAL_STORAGE_MEMORY).forEach((key) => {
      localStorage.setItem(key, LOCAL_STORAGE_MEMORY[key])
    })
  })
}
export default command
